package name.fowler.refactoring.simplestore.reporter;

import java.util.List;


public class AllCustomersMoviesReportFormatter extends ReportFormatter {
	public AllCustomersMoviesReportFormatter() {
	}

	public String formatReport(List<String> reportStructure) {
		StringBuffer buffer = new StringBuffer();
		if (!reportStructure.get(0).equalsIgnoreCase("AllCustomersRentedMoviesStructure")){ 
			report = null;
			return report;
		}
		
		for (int j=1;j<reportStructure.size();j++){
			String[] info = reportStructure.get(j).split("\n");
			buffer.append(info[0]).append(" rented movies list: ");
			for (int i=1;i<info.length;i++){
				buffer.append(info[i]);
				if (i<info.length-1){
					buffer.append(",");
				}
			}
			buffer.append("\n");
		}
		report = buffer.toString();
		return report;
	}

}
